package com.platform.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.platform.dao.ApiResourceDao;
import com.platform.entity.ApiResourceEntity;
import com.platform.service.ResourceService;

/**
 * 图片管理Service实现类
 *
 * @author zhurusen
 * @email 524227263@qq.com
 * @date 2018-06-03 23:35:12
 */
@Service("resourceService")
public class ResourceServiceImpl implements ResourceService {
    @Autowired
    private ApiResourceDao apiResourceDao;

    @Override
    public ApiResourceEntity queryObject(Integer id) {
        return apiResourceDao.queryObject(id);
    }

    @Override
    public List<ApiResourceEntity> queryList(Map<String, Object> map) {
        return apiResourceDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return apiResourceDao.queryTotal(map);
    }

    @Override
    public int save(ApiResourceEntity apiResource) {
        return apiResourceDao.save(apiResource);
    }

    @Override
    public int update(ApiResourceEntity apiResource) {
        return apiResourceDao.update(apiResource);
    }

    @Override
    public int delete(Integer id) {
        return apiResourceDao.delete(id);
    }

    @Override
    public int deleteBatch(Long[] ids) {
        return apiResourceDao.showBatch(ids);
    }

    @Override
    public void isShow(Long id) {
        ApiResourceEntity info = apiResourceDao.queryObject(id);
        if (info != null) {
            info.setIsShow(0);
            apiResourceDao.update(info);
        }
    }

    @Override
    public void unShow(Long id) {
        ApiResourceEntity info = apiResourceDao.queryObject(id);
        if (info != null) {
            info.setIsShow(1);
            apiResourceDao.update(info);
        }
    }
}
